import request from '@/utils/request'

// 查询产品列表
export function listProduct(data) {
    return request({
        url: '/system/productBasicInformation/list',
        method: 'get',
        params: data
    })
}

// 获取产品详细信息
export function detailProduct(id) {
    return request({
        url: '/system/productBasicInformation/selectOne?id=' + id,
        method: 'get'
    })
}

// 新建产品
export function addProduct(data) {
    return request({
        url: '/system/productBasicInformation/insert',
        method: 'post',
        data: data
    })
}

// 编辑产品
export function editProduct(data) {
    return request({
        url: '/system/productBasicInformation/update',
        method: 'post',
        data: data
    })
}

// CKU切换批次或者序列号
export function editProductSku(id) {
    return request({
        url: '/system/productBasicInformation/ckuSwitching?id=' + id,
        method: 'get'
    })
}

// 审核/反审核
export function approveProduct(id, productStatus, approvalStatus) {
    const data = {
        id,
        productStatus,
        approvalStatus
    }
    return request({
        url: '/system/productBasicInformation/uncheck',
        method: 'post',
        data: data
    })
}
// 启用/禁用
export function enableProduct(id, productStatus) {
    const data = {
        id,
        productStatus
    }
    return request({
        url: '/system/productBasicInformation/enableDisable',
        method: 'post',
        data: data
    })
}

// 查询SKU列表
export function listSku(data) {
    return request({
        url: '/system/productBasicInformation/selectProducts',
        method: 'get',
        params: data
    })
}